import Opt from '@/components/dt/info/Opt.js'
import ruleOpt from '@/biz/option/rule.js'
import uploadOpt from '@/biz/option/upload.js'
import { Message } from 'view-design'
let _this = null
class UpdateOpt extends Opt {
  constructor(info, vm) {
    _this = vm
    super(info)
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        title: '考核项',
        // placeholder: '请输入菜单名称',
        key: 'sopName',
        text: {}
        // // visible: this.info.type != 3,
        // rules: [
        //   ruleOpt.required('请输入菜单名称'),
        //   ruleOpt.max(10)
        // ]
      },
      {
        title: '考核延长',
        placeholder: '请输入考核延长',

        key: 'delayDay',
        input: {},
        group: [
          {
            key: 'delayDay',
            disabled: _this.disFlag,
            placeholder: '请输入考核延长',
            input: {
              // type: 'number',
            }
          },
          {
            placeholder: '天',

            text: {}
          }
        ],
        rules: [ruleOpt.required('请输入考核延长'), ruleOpt.positiveInteger()]
      },

      {
        title: '规则生效期',
        key: 'date',
        disabled: _this.disFlag,
        placeholder: '请选择规则生效期',
        xl: 4,
        date: {
          type: 'daterange',
          // format: 'yyyy-MM-dd HH:mm:ss',
          disabled: (date) => {
            // return date.valueOf() <= new Date().getTime()
            return date && date.valueOf() < Date.now() - 86400000
          }
        },
        rules: [
          {
            type: 'array',
            required: true,
            message: '请选择规则生效期',
            trigger: 'blur'
          }
        ]
      }
    ]
  }
}

export default UpdateOpt
